<h4 class="widgettitle shadowed">Download Format Absensi</h4>
<form id="form_download" class="stdform" method="GET" target="_blank" action="<?php echo site_url('admin/absensi_siswa/download_format') ?>" >
	<p>
		<label>Pilih Tahun Pelajaran</label>
		<span class="field">
			<select id="kelas_id_tahun" name="id_tahun" class="uniformselect">
			<?php
				foreach($select_tahun->result() as $pilih_tahun) 
				{
					$cek = '';
					if($id_tahun == $pilih_tahun->id_tahun) $cek = 'selected';
					echo '<option value="'.$this->encrypt->encode($pilih_tahun->id_tahun).'" '.$cek.'>'.$pilih_tahun->tahun_angkatan.'</option>';
				}
			?>
			</select>
		</span>
	</p>
	<p>
		<label>Pilih Kelas</label>
		<span class="field" id="tempat_kelas">
			<select id="kelas_id_kelas" name="id_kelas" class="uniformselect">
			</select>
		</span>
	</p>
        <p>
            <label>Pilih Tanggal</label>
            <span class="field">
                <input name="txt_tanggal" title="Bulan/Tanggal/Tahun" type="text" size="23" value="<?php echo date('m/d/Y') ?>" id="dp1" autocomplete="off">
            </span>
        </p>
	<p>
		<label></label>
		<span class="field">
			<button class="btn btn-danger download"><i class="iconfa-download-alt"></i>&nbsp;Download Format Absensi Siswa</button>
		</span>
	</p>
</form>
<script>
    jQuery(document).ready(function() {
	jQuery('#kelas_id_tahun').change(function(eve) {
            eve.preventDefault();

            jQuery.ajax({
                url: "<?php echo site_url("admin/akademik/kelas") ?>",
                type: "POST",
                dataType: "html",
                data: {'id_tahun' : jQuery('#kelas_id_tahun').val()},
                error: function()
                {
                    jQuery('#tempat_kelas').html('<select id="id_kelas" name="id_kelas" class="uniformselect"><option value="">-data tidak ditemukan-</option></select>');
                },
                success: function(html) {
                    jQuery('#tempat_kelas').html(html);
                }
            });
        });
	<?php 
	if($id_tahun != '') 
	{
		echo 'jQuery("#kelas_id_tahun").change();';
	}
	?>
    });
</script>
<h4 class="widgettitle shadowed">Upload Absensi</h4>
<form id="form_tahun" class="stdform" enctype="multipart/form-data" method="POST" action="<?php echo site_url('admin/absensi_siswa/upload_absensi') ?>" >
	<style>
	.download
	{
		margin	: 3px;
	}
	</style>
	
	<p>
		<label>Upload File</label>
                <span class="field">
                    <input id="id_file" type="file" class="uniform-file" name="file_excel" accept="application/vnd.ms-excel" required />
                </span>
	</p>
        <p>
            <label>&nbsp;</label>
            <span class="field">
                <button type="submit" name="link" class="btn btn-info download"><i class="iconfa-upload-alt"></i>&nbsp;Upload Absensi Siswa</button>
            </span>
        </p>
</form>
<script>
jQuery(document).ready(function() {
	
	jQuery(function(){
          window.prettyPrint && prettyPrint();
          jQuery('#dp1').datepicker({
               format: 'mm/dd/yyyy'
          });
     });

    });
</script>